import Vue from 'vue'
import App from './App.vue'
import router from './router'

import ElementUI from 'element-ui';
import dayjs from 'dayjs';
import 'element-ui/lib/theme-chalk/index.css';
import '@/styles/index.scss' // global css
import store from './store'
import axios from 'axios'
import './icons' // icon
import './permission' // permission control
import isoWeek from 'dayjs/plugin/isoWeek'
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import echarts from 'echarts'
Vue.prototype.$echarts = echarts

Vue.prototype.$axios = axios
Vue.prototype.dayjs = dayjs
Vue.config.productionTip = false

import 'dayjs/locale/zh-cn';// 引入语言配置 
import dayOfYear from 'dayjs/plugin/dayOfYear'
import utc from 'dayjs/plugin/utc'
import timezone from 'dayjs/plugin/timezone'
dayjs.extend(dayOfYear)
dayjs.extend(isoWeek)
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.locale('zh-cn');// 全局使用语言配置

Vue.filter("toPercent",function(val,acc){ //小数转百分比 ，acc为保留小数位
  let num=parseFloat(val);
  if (isNaN(num)) {
    num=0;
  }
  let accuracy = parseInt(acc);
  if (isNaN(accuracy) || accuracy < 0 || accuracy > 10) {
    accuracy = 2;
  }
  return parseInt((num * 100).toFixed(accuracy)) //去掉了百分比符号 并转换为整型
});
Vue.use(ElementUI);
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
